package com.workoutgrabber.model;

import org.jdom.Element;

public class ExerciseSet implements XMLable {
	private Double weight;
	private Integer reps;
	
	private ExerciseSet(Double weight, Integer reps){
		this.weight = weight;
		this.reps = reps;
	}
	
	public static ExerciseSet getInstance(Double weight, Integer reps){
		return new ExerciseSet(weight, reps);
	}
	
	public Double getWeight() {
		return weight;
	}
	public Integer getReps() {
		return reps;
	}

	@Override
	public Element getAsXML() {
		Element exerciseElement = new Element("set");
		
		Element repsElement = new Element("reps");
		repsElement.setText(this.reps.toString());
		
		Element weightElement = new Element("weight");
		weightElement.setText(this.weight.toString());
		
		exerciseElement.addContent(repsElement);
		exerciseElement.addContent(weightElement);
		
		return exerciseElement;
	}
}
